﻿using Com.JunCaiSoft.DBContext;
using Com.JunCaiSoft.Law.Dao;
using Com.JunCaiSoft.Law.IDao;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Com.JunCaiSoft.Law
{
    public static class LawServiceCollectionExtension
    {
        public static IServiceCollection AddLaw(this IServiceCollection services)
        {

            //添加案件信息相关注入
            services.TryAddSingleton<ICaseMainDao>(new CaseMainDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));
            //添加保全管理相关注入
            services.TryAddSingleton<IPreservationDao>(new PreservationDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));
            //添加案件跟踪相关注入
            services.TryAddSingleton<ICaseHandleDao>(new CaseHandleDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));
            //添加执行案件相关注入
            services.TryAddSingleton<IExcuteCaseDao>(new ExcuteCaseDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));
            //添加解冻申请相关注入
            services.TryAddSingleton<IUnFreezingApplicationDao>(new UnFreezingApplicationDao(services.BuildServiceProvider().GetService<MSSQLDbContext>()));

            return services;
        }
    }
}
